<template>
    <div class="project-mb" v-if="detailmbshow">
      <!-- 项目详情 -->
      <div class="projectdetails-content" v-if="detailsmlshow">
        <div class="projectdetails-title">
          <div class="projectdetails-title-imgortitle">
            <img src="../common/image/icon_detai.png" alt="">
            <h3>编辑项目</h3>
          </div>
          <div class="projectdetails-title-img" @click="chossdetails">
            <img src="../common/image/icon_choss.png" alt="">
          </div>
        </div>
        <div class="projectcreate-content-k">
        <div class="projectcreate-k">
          <h1 class="projectcreate-name" @click="bdshuj">请输入项目名称</h1>
          <input type="text" v-model="bjdata.projectName">
        </div>
        <div class="projectcreate-k">
          <h1 class="projectcreate-name">请选择截止日期</h1>
          <div class="project-picker">
            <el-date-picker
            v-model="bjdata.projectEndDate"
            type="date"
            value-format="YYYY-MM-DD"
            :disabled-date="disabledDatestart"
            placeholder="Pick a day"
            @change='panelchange'
           />
          </div>
          
        </div>
        <div class="projectcreate-k">
          <h1 class="projectcreate-name">项目描述</h1>
          <input type="text" v-model="bjdata.projectDescribe">
        </div>
        <div class="projectcreate-k">
          <h1 class="projectcreate-name">抄送</h1>
          <!-- .slice( 0,3) -->
          <div class="projectcreate-cs" v-if="bjdata.ccUserList.length>3">
<!-- bjdata.value.ccUserList -->
            <div v-for="(item,index) in bjdata.ccUserList.slice(0,3)" :key="index"><img :src="item.wxHeadImage" alt=""></div>
<!-- @click="addcs" -->
            <div class="yccs-nun">{{bjdata.ccUserList.length}}+</div>
            <div @click="csdx"><img src="../common/image/icon_add_b.png" alt=""></div>
            
          </div>
           <div class="projectcreate-cs" v-if="bjdata.ccUserList.length<=3">
<!-- bjdata.value.ccUserList -->
            <div v-for="(item,index) in bjdata.ccUserList" :key="index"><img :src="item.wxHeadImage" alt=""></div>
<!-- @click="addcs" -->
            <div @click="csdx"><img src="../common/image/icon_add_b.png" alt=""></div>
          </div>
          
        </div>
        <div class="projectcreate-tjzp" @click="newjp(0)" v-if="!bjdata.workAssignList || bjdata.workAssignList==false">
          <div>添加指派</div>
        </div>
        <div  v-for="(item,index) in bjdata.workAssignList" :key="index">
        <div class="projectcreate-tjzp-k-con" v-if="item.status==0">
        <div class="projectcreate-tjzp-k">
          <div class="projectcreate-tjzp-k-t" >
            <h1>指派{{index+1}}-{{item.projectName}}</h1>
            <div class="projectcreate-choosorshow">
              <div @click="removezpobj(item.id,index)"><img src="../common/image/icon_choss.png" alt=""></div>
           
            <div @click="listzk(index)" v-if="item.workAssignListshow==false">
            
            <img src="../common/image/icon_fold_white.png" alt="">
            </div>
            </div>
          </div>
          <div class="projectcreate-tjzp-nr" v-if="item.workAssignListshow">
            <div class="projectcreate-tjzp-nr-list">
              <div class="projectcreate-tjzp-nr-list-name">指派名称</div>
              <!-- :value="item.projectName" -->
              <input type="text"  v-model="bjdata.workAssignList[index].projectName">
            </div>
            <div class="projectcreate-tjzp-nr-list">
              <div class="projectcreate-tjzp-nr-list-name">截止日期</div>

              <div class="project-picker-zi">
                <!-- @click='focusfun(index)' -->
                  <el-date-picker
                  v-model="bjdata.workAssignList[index].projectEndDate"
                  type="date"
                  placeholder="Pick a day"
                  value-format="YYYY-MM-DD"
                  :disabled-date="disabledDate"
                  @change='panelzichangelist'
                  
                  @panel-change='changelist'
                />
             </div>
            </div>
            <div class="projectcreate-tjzp-nr-list">
              <div class="projectcreate-tjzp-nr-list-name">指派对象</div>
              <div class="projectcreate-tjzp-nr-list-tx" >
                <img class="zp-img" :src="item.wxHeadImage" alt="" v-if="item.wxHeadImage">
                <div @click="zpobj(index)">
                <img src="../common/image/icon_add_b.png" alt="">
                </div>
              </div>
            </div>
            <div class="projectcreate-tjzp-nr-list">
              <div class="projectcreate-tjzp-nr-list-name">指派说明</div>
              <!-- :value="item.projectDescribe" -->
              <input type="text" v-model="bjdata.workAssignList[index].projectDescribe">
            </div>
            <div class="projectcreate-tjzp-nr-list-choss" @click="listcloos(index)">
              <img src="../common/image/icon_fold.png" alt="">
            </div>
          </div>
        </div>
        <div class="projectcreate-tjzp" @click="newjp(index+1)" v-if="index+1 == bjdata.workAssignListlenght">
          <div>添加新指派{{index+2}}</div>
        </div>
       </div>
    </div>
        <div class="projectcreate-k">
          <h1 class="projectcreate-name">添加附件</h1>
          <div class="projectcreate-upload">
            <!-- :http-request="uploadAction" -->
              <!-- :on-exceed="handleExceed" -->
              <div class="uploadFilelist">
              </div>
            <el-upload
            ref="uploadFile"
              class="upload-demo"
              drag
              action="#"
              multiple
              name="file"
              method='post'
              :on-success='filesuccess'
              :auto-upload='false'
              :before-upload="beforeUpload"
              v-model:file-list='filelist' 
            >
              <el-icon class="el-icon--upload"><upload-filled /></el-icon>
              <div class="el-upload__text">
                 您可以点击这里上传文件，<br><em>或把文件拖放到这里。</em>
             </div>
            <!-- <template #tip>
             <div class="el-upload__tip">
              jpg/png files with a size less than 500kb
               </div>
               </template> -->
             </el-upload></div>
          
        </div>

        
        </div>



         <div class="projectcreate-bt">
          <div class="projectcreate-bt-qx" @click="qxclick">取消</div>
          <div class="projectcreate-bt-wc" @click="tjwc">完成</div>
        </div>

        

        

      </div>

<!-- 选择对象 -->
<div class="project-zp-obj" v-if="userListshow">
          <div class="project-zp-obj-k">
             <div class="project-zp-obj-title">
                <h1>选择指派对象</h1>
                <div @click="chooscaoso">
                  <img src="../common/image/icon_choss.png" alt="">
                </div>
             </div>
             <div class="project-zp-obj-input">
              <img src="../common/image/icon_s.png" alt="">
              <input type="text" >
             </div>

             <div class="project-zp-obj-objlist">
                <div class="project-zp-obj-tops" @click="zuigaoc"> <div @click="zochick">{{zgshow?'-':'+'}}</div><h1> SUFN三峰照明</h1></div>

                <ul class="project-zp-obj-objlist-ul" v-if="zgshow">
                  <li v-for="(item,index) in officeList" :key="index">
                    <div class="project-zp-obj-objlist-ul2">
                      <div  class="project-zp-obj-tops" @click="onedj(index)"><div>{{item.isshow?'-':'+'}}</div><h1>{{item.officeName}}</h1></div>
                  
                      <ul v-if="item.isshow">
                        <li>
                          <div class="project-zp-obj-zi" v-for="(itemof,index2) in item.userList" :key="index2" 
                          @click="ativiteobj(itemof)"><div class="project-zp-obj-bm-zi hengxuxian1"><input type="radio" name="obj"><img :src="itemof.wxHeadImage" alt="">{{itemof.name}}</div></div>
                          <div class="project-zp-obj-zi-bm " v-for="(itemsb,indexsb) in item.subList" :key="indexsb"> 
                             <div  class="project-zp-obj-tops hengxuxian1"  @click="twodj(indexsb,itemsb)"><div>{{itemsb.isshow?'-':'+'}}</div><h1>{{itemsb.officeName}}</h1></div>
                             <ul class="project-zp-obj-zi-bm-ul" v-if="itemsb.isshow">
                              <li>
                                <div class="project-zp-obj-zi" v-for="(itemtwo,indextwo) in itemsb.userList" :key="indextwo"  @click="ativiteobj(itemtwo)">
                                  <div class="project-zp-obj-bm-zi project-zp-obj-zi-2 hengxuxian2"><input type="radio" name="obj"><img :src="itemtwo.wxHeadImage" alt="">{{itemtwo.name}}</div></div> 
                              </li>
                             </ul>
                          </div>
                        </li>
                      </ul>
                    </div>
                    
                    
                  </li>
                  
                </ul>
                
             </div>
             <div class="project-zp-obj-bt"><div class="project-zp-obj-bt-qr" @click="qrobj">确认</div></div>
             
          </div>

          

        </div>


        <!-- 抄送选择 -->
        <div class="project-zp-obj" v-if="ccUserListshow">
          <div class="project-zp-obj-k">
             <div class="project-zp-obj-title">
                <h1>选择抄送对象</h1>
                <div @click="chooscsdx">
                  <img src="../common/image/icon_choss.png" alt="">
                </div>
             </div>
             <div class="project-zp-obj-input">
              <img src="../common/image/icon_s.png" alt="">
              <input type="text"  @change="caossuosuo" v-model="csnames">
             </div>

             <div class="project-zp-obj-objlist">
                <div class="project-zp-obj-tops" @click="zuigaoc"> <div @click="zochick">{{zgshow?'-':'+'}}</div><h1> SUFN三峰照明</h1></div>

                <ul class="project-zp-obj-objlist-ul" v-if="zgshow">
                  <li v-for="(item,index) in officeList" :key="index">
                    <div class="project-zp-obj-objlist-ul2">
                      <div  class="project-zp-obj-tops" @click="onedj(index)"><div>{{item.isshow?'-':'+'}}</div><h1>{{item.officeName}}</h1></div>
                  
                      <ul v-if="item.isshow">
                        <li>
                          <div class="project-zp-obj-zi" v-for="(itemof,index2) in item.userList" :key="index2" 
                          @click="ativitecsobj(itemof)"><div class="project-zp-obj-bm-zi hengxuxian1"><input type="checkbox" name="obj" :checked='itemof.isxz'><img :src="itemof.wxHeadImage" alt="">{{itemof.name}}</div></div>
                          <div class="project-zp-obj-zi-bm" v-for="(itemsb,indexsb) in item.subList" :key="indexsb"> 
                             <div  class="project-zp-obj-tops hengxuxian1"  @click="twodj(indexsb,itemsb)"><div>{{itemsb.isshow?'-':'+'}}</div><h1>{{itemsb.officeName}}</h1></div>
                             <ul class="project-zp-obj-zi-bm-ul" v-if="itemsb.isshow" >
                              <li>
                                <div class="project-zp-obj-zi "  v-for="(itemtwo,indextwo) in itemsb.userList" :key="indextwo">
                                  <div class="project-zp-obj-bm-zi project-zp-obj-zi-2 hengxuxian2"   @click="ativitecsobj(itemtwo)"><input type="checkbox" :checked='itemtwo.isxz' name="obj"><img :src="itemtwo.wxHeadImage" alt="">{{itemtwo.name}}</div></div> 
                              </li>
                             </ul>
                          </div>
                        </li>
                      </ul>
                    </div>
                    
                    
                  </li>
                  
                </ul>
                
             </div>

             <div class="project-zp-obj-bt">
              <div class="project-zp-obj-bt-qx" @click="selectallfun"> 
               <input  type="checkbox" :checked='selectall'>全选</div>
               <div class="project-zp-obj-bt-qr" @click="csobjfun" v-if="csnames==''">确认</div>
               <div class="project-zp-obj-bt-qr" @click="csobjfun2" v-if="csnames!=''">确认</div>
          </div>
          </div>
 <!-- @click="qrobj" -->
          

        </div>

         <!-- 新建成功 -->
      
       <div class="project-lq" v-if="detailsxjxmshow">
        <div class="project-lq-k">
          <div>
            <img src="../common/image/icon_lqcg.png" alt="">
            <p>您已成功创建项目!</p>
            <p>可在<span>项目列表</span>中查看或修改</p>
          </div>
        </div>
        <div class="project-lq-choss" @click="projectcgkchoss"><img src="../common/image/icon_choss.png" alt=""></div>
      </div>
    


    </div>
</template>
<script >
import { computed,defineComponent, ref, reactive,defineEmits} from "vue";
import { Flag, Search } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import 'element-plus/theme-chalk/el-loading.css';
import 'element-plus/theme-chalk/el-message.css';
import {getUserList,getCcUserList,saveFileUpload,createProject} from '../api/api'
import qs from 'qs'
import axios from 'axios'
// import projectedit from '@/views/project/projecttj.vue';

export default defineComponent({
  name: "project",
  props:{
    chartinfo: Array,
  },
  components: {
  },
  setup(props,context){
    // const detailsshow=ref(false)
    const detailsmlshow=ref(false)
    const detailslcshow=ref(false)
    const detailsthshow=ref(false)
    const detailssqcgshow=ref(false)
    const userListshow=ref(false)
    const detailmbshow=ref(false)
    const detailsxjxmshow=ref(false)
    const userId=localStorage.getItem('userinfoId')

    const emit = defineEmits(['qxclick','chossdetails'])
     const randomWord =()=>{
    var chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
     var nums = "";
      for (var i = 0; i < 20; i++) {
      var id = parseInt(Math.random() * 61);
      nums += chars[id]
      }
      return nums; 
      }

    const qxclick = ()=>{
      console.log('取消')
     
      bjdata.projectName=''
      bjdata.projectEndDate=''
      bjdata.projectDescribe=''
      bjdata.ccUserList=[]
      bjdata.workAssignList=[]
      filelist.value=[]
      console.log("bjdata.value",bjdata.value)
      detailsmlshow.value=false
      detailmbshow.value=false
      
      // context.emit('qxclick')
    }
    const bjdata=reactive({
      // projectName:''
      ccUserList:[]
    })
    const shartdata=ref('')
    const tokens=ref('')

const getNowFormatDate=()=>{
  
  
  let date = new Date(),
    year = date.getFullYear(), //获取完整的年份(4位)
    month = date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
    strDate = date.getDate() // 获取当前日(1-31)
  if (month >= 1 && month <= 9) month = '0' + month // 如果月份是个位数，在前面补0
  if (strDate >= 0 && strDate <= 9) strDate = '0' + strDate // 如果日是个位数，在前面补0
 
  let currentdate = `${year}-${month}-${strDate}`
  return currentdate
  }
    const openprojectedit = ()=>{
      bjdata.value={
      }
      bjdata.workAssignList=[]
      console.log('bjdata',bjdata.workAssignList)
      // console.log(val)
      // console.log('sddassddew')
      filelist.value=[]
      detailsmlshow.value=true
      detailmbshow.value=true
      if(bjdata.workAssignList){
      bjdata.workAssignList.forEach(element => {
        element.workAssignListshow=false
        
      });
      
      
      }
      bjdata.projectEndDate=getNowFormatDate()
      console.log('bjdatas',bjdata)
      // console.log('日期',bjdata.projectEndDate)
      // bjdata.value=val
      // shartdata.value=val.projectBeginDate
      // console.log(new Date(shartdata.value).getTime())
      // value1.value=val.projectEndDate
      // console.log(val)
      // bjdata.value.workAssignListlenght=bjdata.value.workAssignList.length
      // 抄送对象
      // bjdata.value.ccUserList
      

      // bjdata.workAssignList.forEach(element => {
      //   if(element.status!=0){
      //     bjdata.value.workAssignListlenght=''
      //   }else{
      //     chuand +=1
      //     bjdata.value.workAssignListlenght=bjdata.value.workAssignList.length
      //     console.log(chuand)
      //   }
      // });

    var sjs=randomWord()
    var datatime = Date.parse(new Date());
    tokens.value=''+sjs+''+datatime+''+localStorage.getItem('userinfoId')

      // console.log(bjdata.value)
      
    }
    const disabledDatestart=(time) => {
//       //b-a从大到小，a-b从小到大
// var max2 = arr.sort(function(a,b){
// return b-a;
// })[0];


      console.log('sdas',shartdata.value)
      
      return time.getTime() < new Date().getTime()-24*60*60*1000
}
    const disabledDate = (time) => {

      // if(typeof(bjdata.projectEndDate)=="undefined" || bjdata.projectEndDate==''){
       return (time.getTime() > new Date(bjdata.projectEndDate).getTime()) || (time.getTime() < new Date().getTime()-24*60*60*1000)
      // }else{
        
      //     return (time.getTime() > new Date(bjdata.projectEndDate).getTime()) || (time.getTime() < new Date().getTime()-24*60*60*1000)
      // }

      console.log('sdas',shartdata.value)
      
}


    const chossdetails =()=>{
      // detailsshow.value=false
      bjdata.projectName=''
      bjdata.projectEndDate=''
      bjdata.projectDescribe=''
      bjdata.ccUserList=[]
      filelist.value=[]
      detailsmlshow.value=false
      detailmbshow.value=false
      context.emit('chossdetails')
    }
    const projectjs = ()=>{
      detailsmlshow.value=false
      detailslcshow.value=true
    }
    
    const projectchoss=()=>{
      detailsmlshow.value=true
      detailslcshow.value=false
    }
     const projectth=()=>{
      detailsmlshow.value=false
      detailsthshow.value=true
    }
    const projectrwqx=()=>{
      detailsmlshow.value=true
      detailsthshow.value=false
    }
    const projectrwqr=()=>{
      detailsthshow.value=false
      detailssqcgshow.value=true
    }
    const projectrwsqwc=()=>{
       detailssqcgshow.value=false
       detailsshow.value=false
    }
    const projectcreateshow=()=>{
      detailsmlshow.value=true
      detailsshow.value=true
    }
      const officeList=ref([])
      const atxzobjnun=ref(-1)
    const zpobj=(index)=>{
      atxzobjnun.value=index
       getUserList({userId:localStorage.getItem('userinfoId'),name:''}).then(
        res=>{
          console.log(res)
            let list=[]
            res.officeList.forEach((element,index)=> {
              
              element.isshow=false
              list[index]=element
              element.userList.forEach((elementuser,indexuser)=>{
                // if(bjdata.workAssignList!=''){
                //   bjdata.workAssignList.forEach(element => {
                //     if(element.targetUserId==elementuser.id){
                //       elementuser.isxz=true
                //     }else{
                //      elementuser.isxz=false
                //     }
                //   });
                // }
                
                elementuser.isxz=false
                
                list[index].userList[indexuser]=elementuser
              })
              
              if(typeof(element.subList)!='undefined'){
                element.subList.forEach((elements,indextow)=> {
                  elements.isshow=false
                  list[index].subList[indextow]=elements
                  elements.userList.forEach((elementuser,indexuser)=>{
                    elementuser.isxz=false
                 
                
                    list[index].subList[indextow].userList[indexuser]=elementuser
                  })

                })
              }
              
            });
          console.log('list',list)
          officeList.value=res.officeList
          userListshow.value=true
          detailsmlshow.value=false

        }).catch(res => {
                ElMessage({
                    message: res,
                    type: 'error',
                })
            });


    }
    // const officeList=ref([])
    // 抄送
    const caoso=()=>{
      getUserList({userId:localStorage.getItem('userinfoId'),name:''}).then(
        res=>{
          console.log(res)
            let list=[]
            res.officeList.forEach((element,index)=> {
              
              element.isshow=false
              list[index]=element
              element.userList.forEach((elementuser,indexuser)=>{
                elementuser.isxz=false
                
                list[index].userList[indexuser]=elementuser
              })
              
              if(typeof(element.subList)!='undefined'){
                element.subList.forEach((elements,indextow)=> {
                  elements.isshow=false
                  list[index].subList[indextow]=elements
                  elements.userList.forEach((elementuser,indexuser)=>{
                    elementuser.isxz=false
                
                    list[index].subList[indextow].userList[indexuser]=elementuser
                  })

                })

              }
              

              
            });
          console.log('list',list)
          officeList.value=res.officeList
          userListshow.value=true
          detailsmlshow.value=false

        }).catch(res => {
                ElMessage({
                    message: res,
                    type: 'error',
                })
            });
      
    }
    const chooscaoso=()=>{
      userListshow.value=false
      detailsmlshow.value=true
    }
     const ccUserListshow=ref(false)


      const csdx=()=>{
        
        getCcUserList({userId:localStorage.getItem('userinfoId'),name:''}).then(
        res=>{
          console.log(res)
            let list=[]
            res.officeList.forEach((element,index)=> {
              
              element.isshow=false
              list[index]=element
              element.userList.forEach((elementuser,indexuser)=>{
                elementuser.isxz=false
                //是否有选中的
               if(bjdata.ccUserList){
                bjdata.ccUserList.forEach(elementcc => {
                  if(elementuser.id==elementcc.id){
                    elementuser.isxz=true
                    element.isshow=true
                  }
                });
               } 
                
                if(elementuser.isxz==false){
                  selectall.value=false
                }
                
                list[index].userList[indexuser]=elementuser
              })
              
              if(typeof(element.subList)!='undefined'){
                element.subList.forEach((elements,indextow)=> {
                  elements.isshow=false
                  list[index].subList[indextow]=elements
                  elements.userList.forEach((elementuser,indexuser)=>{
                    elementuser.isxz=false
                    //二级是否有选中的

                    if(bjdata.ccUserList){
                        bjdata.ccUserList.forEach(elementccs => {
                          if(elementuser.id==elementccs.id){
                            elementuser.isxz=true
                            elements.isshow=true
                          }

                        });
                    } 
                 if(elementuser.isxz==false){
                  selectall.value=false
                }
                    list[index].subList[indextow].userList[indexuser]=elementuser
                  })

                })

              }
            });
          console.log('list',list)
          officeList.value=res.officeList
          ccUserListshow.value=true
          detailsmlshow.value=false

        })
        // .catch(res => {
        //         ElMessage({
        //             message: res,
        //             type: 'error',
        //         })
        //     });
      
    }
   
     const chooscsdx=()=>{
      ccUserListshow.value=false
      detailsmlshow.value=true
    }
    //抄送对象点击一级or二级
     const isquanxuan=ref(true)
    const ativitecsobj=(index)=>{
      const isquanxuan=ref(true)
      let isinobjlist=false
      bjdata.workAssignList.forEach(element => {
        console.log('index',index)
        console.log('index.id',index.id)
         console.log('bjdata.workAssignList',bjdata.workAssignList)
        if(element.targetUserId==index.id){
          isinobjlist=true
        }
      });
      console.log('isinobjlist',isinobjlist)
      if(isinobjlist){
        // officeList.value.forEach(element => {
        //  element.userList.forEach((elementuser,indexuser)=>{
            
        //         if(elementuser.id==index.id){
        //           console.log(elementuser.id,index.id)
        //           elementuser.isxz=false
        //         }
                
        //       })
        //  if(typeof(element.subList)!='undefined'){
        //         element.subList.forEach((elements,indextow)=> {
        //           // elements.isshow=false
        //           // list[index].subList[indextow]=elements
        //           elements.userList.forEach((elementuser,indexuser)=>{
        //             //  console.log(elementuser.id,index.id)
        //             if(elementuser.id==index.id){
        //               elementuser.isxz=false
        //             }
                 
                
        //             // list[index].subList[indextow].userList[indexuser]=elementuser
        //           })

        //         })
        //       }     
          
        // });
        console.log('officeList.value',officeList.value)
        index.isxz= false
         ElMessage({
                    message: '该抄送人已有指派任务选择将无效，请重新选择',
                    type: 'warning',
                })
      }else{
        index.isxz= !index.isxz
      officeList.value.forEach(element => {
      element.userList.forEach((elementone,indexone) => {
        if(elementone.isxz==false) {
           isquanxuan.value=false
          //  console.log()
        }
        
       if(element.subList){
          element.subList.forEach((elementone,indexone) => {
            elementone.userList.forEach((elementtwo,indextwo) => {
              if(elementtwo.isxz==false) {
                isquanxuan.value=false
                }
            })
         })

       }
        
       })
    
      
      

    });
    if(isquanxuan.value){
      console.log('isquanxuan.value',isquanxuan.value)
      selectall.value=true
    }else{
      selectall.value=false
      console.log('isquanxuan.value',isquanxuan.value)
    }
    
      console.log( officeList.value)

      }
      console.log(index.id)
      
      
      
      
    }
    const zochick =()=>{

    }
    
    
     const bdshuj =()=>{
      console.log('projectName',bjdata.value.projectName)
     }
    //  日期选择
     const value1 = ref('')
     const panelchange=(val)=>{
      console.log(bjdata.value)
      // var startdate = new Date(bjdata.value.projectBeginDate+' 00:00:00').getTime()
      // if(val.getTime()<startdate){
      //   ElMessage({
      //               message: '截止日期小于项目创建日期请重新选择',
      //               type: 'warning',
      //           })
      //   value1.value=bjdata.value.projectBeginDate
      // }
     
     }
     //一级展开
     const onedj =(index)=>{
        officeList.value[index].isshow=!officeList.value[index].isshow
     }

       //二层点击
    const twodj = (index,indexsb)=>{
      console.log(index,indexsb)
      // bjdata.value.workAssignList[index].workAssignListshow=true
      indexsb.isshow=!indexsb.isshow
    }
    //  展开
     const listshow =ref(false)
     const listzk = (index)=>{

       listshow.value = true
       bjdata.workAssignList[index].workAssignListshow=true
       console.log(bjdata.workAssignList[index].workAssignListshow)
       console.log(listshow.value)
     }
     //关闭 
    const listcloos = (index)=>{
      bjdata.workAssignList[index].workAssignListshow=false
      listshow.value=false
      console.log(bjdata.workAssignList[index].workAssignListshow)
    }
    // 选择一级对象
    const xzite=ref({})
    const ativiteobj=(item)=>{
      xzite.value={}
      console.log(' bjdata.workAssignList',bjdata.workAssignList)
      console.log(' bjdata.workAssignList2',item.id)
     let ischu=true
      bjdata.workAssignList.forEach((element,index) => {
        console.log('element.id',element.id)
        // atxzobjnun
        if(index!=atxzobjnun.value){
        if(element.targetUserId==item.id){
          ischu=false
          ElMessage({
                    message: '该指派对象已有当前任务指派，请重新选择',
                    type: 'warning',
                })
               
        }
        } 
      });
        

        if(ischu){
          xzite.value=item
      console.log(item)
      console.log(xzite.value)
        }
   
      
      
      // bjdata.value.workAssignList[atxzobjnun.value].wxHeadImage=item.wxHeadImage
      // bjdata.value.workAssignList[atxzobjnun.value].targetUserId=item.id
      // console.log(bjdata.value.workAssignList[atxzobjnun.value].targetUserId)
      
    }
    // 确认选择
    const qrobj =()=>{
      console.log(bjdata.ccUserList)
      console.log('dasdas')
      let isyouchaos=false
      bjdata.ccUserList.forEach(element => {
        console.log(element)
        if (element.id==xzite.value.id) {
          isyouchaos=true
        }
        
      });
      if(isyouchaos){
         ElMessage({
                    message: '您选择指派对象已在抄送列表中，请重新选择',
                    type: 'warning',
                })
      }else{
        if(xzite.value.id){
        bjdata.workAssignList[atxzobjnun.value].wxHeadImage=xzite.value.wxHeadImage
        bjdata.workAssignList[atxzobjnun.value].targetUserId=xzite.value.id
        userListshow.value=false
        detailsmlshow.value=true
      }else{
         ElMessage({
                    message: '您未选择指派对象或该对象已有指派，请重新选择',
                    type: 'warning',
                })
      }
      }
      console.log("bjdata.workAssignList",bjdata.workAssignList)
      
      
      // bjdata.value.workAssignList[atxzobjnun.value].wxHeadImage=item.wxHeadImage
      // bjdata.value.workAssignList[atxzobjnun.value].targetUserId=item.id
    }
    //添加抄送
    const addcs =()=>{
    }
    // 添加指派对象
    const newjp =(index)=>{
      
      if(index==0){
        bjdata.workAssignList=[]
        // console.log('bjdata',bjdata.workAssignList)
      }
      
      bjdata.workAssignList[index]={
        workAssignListshow:true,
        status:0,
        id:'',
        targetUserId:'',
        projectName:'',
        projectEndDate:'',
        projectDescribe:'',
      }
      bjdata.workAssignListlenght=bjdata.workAssignList.length
      console.log('添加招牌对象了',bjdata.workAssignList)
    }
    //删除指派对象
    const removezpobj=(id,index)=>{
      console.log('id',id,'index',index)
      if(id!=''){
       
        bjdata.workAssignList.forEach(element => {
          if(element.id==id){
             
            element.status=1
          // console.log(element.status)
          
          }
          
        });
        
       
      }else{
          console.log('2')
         bjdata.workAssignList.splice(index, 1)
         bjdata.workAssignListlenght=bjdata.workAssignList.length
      }
      // bjdata.value.workAssignListlenght=bjdata.value.workAssignList.length
      let chuand=0
      bjdata.workAssignList.forEach(element => {
        if(element.status!=0){
          bjdata.value.workAssignListlenght=''
        }else{
          chuand +=1
          bjdata.workAssignListlenght=bjdata.workAssignList.length
        }
      });
     
      console.log(bjdata.value)
    }
    //最高层点击
    const zgshow=ref(true)
    const zuigaoc=()=>{
        zgshow.value=!zgshow.value
    }
   
    // 对象选择
    const defaultProps = {
      children: 'children',
      label: 'label',
      disabled: 'disabled',
    }
    //选择子列表截止日期
    const ziindex=ref(-2)
    const focusfun =(e)=>{
      console.log('sdasd',e)
      ziindex.value=e
    }
    const datalists=ref([])
    const panelzichangelist=(date)=>{
    //   console.log('选择子列表截止日期',date)
    //   console.log(ziindex.value)
      
    //   bjdata.workAssignList.forEach((element,index) => {
    //     datalists[index]=element.projectEndDate
    //   });
    //   //b-a从大到小，a-b从小到大
    // var max2 = arr.sort(function(a,b){
    // return a-b;
    // })[0];
      // console.log(bjdata.value.workAssignList[ziindex.value].projectBeginDate)
      // var startdates = new Date(bjdata.value.workAssignList[ziindex.value].projectBeginDate+' 00:00:00').getTime()
      // if(val.getTime()<startdates){
      //   ElMessage({
      //               message: '截止日期小于项目创建日期请重新选择',
      //               type: 'warning',
      //           })
      //   bjdata.value.workAssignList[ziindex.value].projectEndDate= bjdata.value.workAssignList[ziindex.value].projectBeginDate
      // }



    }
    const changelist=(date, mode, view)=>{
      console.log('qqq')
      console.log('选择子列表截止日期2',date, mode, view)
    }
    const data = ref([
     {
      id: 1,
      label: 'Level one 1',
      children: [
      {
        id: 3,
        label: 'Level two 2-1',
        children: [
          {
            id: 4,
            label: 'Level three 3-1-1',
          },
          {
            id: 5,
            label: 'Level three 3-1-2',
            disabled: true,
          },
        ],
      },
      {
        id: 2,
        label: 'Level two 2-2',
        disabled: true,
        children: [
          {
            id: 6,
            label: 'Level three 3-2-1',
          },
          {
            id: 7,
            label: 'Level three 3-2-2',
            disabled: true,
          },
        ],
      },
    ],
  },
])  
const beforeUpload = (file) => {
           console.log(file)
        }
    const filesuccess =(response,uploadFile,uploadFiles)=>{
      console.log(response,uploadFile,uploadFiles)

    }
    // {"token":"","id":"","userId":"","projectName":"","projectEndDate":"","ccUserIds":"","projectDescribe":"","projectFiles":"","projectFilesNames":"",
    // "workAssignList":[{"id":"","status":"(0：正常；1：删除)","targetUserId":"","projectName":"","projectEndDate":"","projectDescribe":"","projectFiles":"","projectFilesNames":""},
    // {"id":"","status":"","targetUserId":"","projectName":"","projectEndDate":"","projectDescribe":"","projectFiles":"","projectFilesNames":""}]}
    const filelist=ref([])
     //生成随机数
  

    const Informationnotfilled=ref(true)
    const tjwc=()=>{



    //    if(filelist.value.length !=0 ){
    //       for(let i = 0; i < uuidArr.length; i++){
    //     for(let j = i+1; j < uuidArr.length; j++){
    //         if(uuidArr[i] == uuidArr[j]){
    //             flag = false;
    //             break;
    //         }
    //     }
    // }
    // if(!flag){
    //     alert("有相同项！");
    // }else{
    //     alert("都不相同")
    // }
      console.log(bjdata)


  Informationnotfilled.value=true
  console.log(filelist.value)

      // 生成随机数
   

      var projectFiles=''
      var projectFilesNames=''
      var uploadcg=0
      // 有文件上传
      if(filelist.value.length !=0 ){
            
          
      filelist.value.forEach((element,index) => {
        
        let form = new FormData();
         
         console.log(uploadcg)
          form.append('file', element);
          console.log('form',form)
          
        saveFileUpload({file:element.raw,userId:localStorage.getItem('userinfoId'),fileName:element.name}).then(res=>{
          console.log(res)
          if(res.result==0){
           uploadcg +=1
            if(projectFiles==''){
              projectFiles='https://test.at1984.com'+res.fileUrl
            }else{
              projectFiles +=',https://test.at1984.com'+res.fileUrl
            }
            if(projectFilesNames==''){
              projectFilesNames=res.fileName
            }else{
              projectFilesNames +=','+res.fileName
            }
            console.log(filelist.value.length,index)
            if(filelist.value.length == uploadcg){
              console.log('projectFiles',projectFiles)

              // {"token":"","id":"","userId":"","projectName":"","projectEndDate":"","ccUserIds":"","projectDescribe":"","projectFiles":"","projectFilesNames":"","workAssignList":
              // [{"id":"","status":"(0：正常；1：删除)","targetUserId":"","projectName":"","projectEndDate":"","projectDescribe":"","projectFiles":"","projectFilesNames":""},
              // {"id":"","status":"","targetUserId":"","projectName":"","projectEndDate":"","projectDescribe":"","projectFiles":"","projectFilesNames":""}]}
              //存储


             
         if(typeof(bjdata.projectName)=='undefined' || bjdata.projectName==''){
                 ElMessage({
                    message: '请输入您的项目名称',
                    type: 'warning',
                })
                Informationnotfilled.value=false
              }else if(typeof(bjdata.projectEndDate)=='undefined' || bjdata.projectEndDate==''){
                ElMessage({
                    message: '请选择您的项目截止日期',
                    type: 'warning',
                })
                Informationnotfilled.value=false
              }else if(typeof(bjdata.projectDescribe)=='undefined' || bjdata.projectDescribe==''){
                ElMessage({
                    message: '请添加您的项目描述',
                    type: 'warning',
                })
                Informationnotfilled.value=false
              }else if( typeof(bjdata.workAssignList) =='undefined' || bjdata.workAssignList==false){
                ElMessage({
                    message: '请添加您的指派列表',
                    type: 'warning',
                })
                Informationnotfilled.value=false
              }else {


                try{
                  
               
                bjdata.workAssignList.forEach(element => {
                if(element.targetUserId=='' ){
                  ElMessage({
                    message: '您的指派列表--有指派对人未添加',
                    type: 'warning',
                    
                })
                Informationnotfilled.value=false
                throw Error()
                }else if(element.projectName=='' ){
                  ElMessage({
                    message: '您的指派列表--有指派项目名称未填写',
                    type: 'warning',
                })
                Informationnotfilled.value=false
                throw Error()
                }else if(element.projectEndDate=='' ){
                  ElMessage({
                    message: '您的指派列表--有指派截止日期未选择',
                    type: 'warning',
                })
                Informationnotfilled.value=false
                throw Error()
                }else if(element.projectEndDate=='' ){
                  ElMessage({
                    message: '您的指派列表--有指派项目说明未填写',
                    type: 'warning',
                })
                Informationnotfilled.value=false
                throw Error()
                }
               
                
                 });
                 } catch(error) {
                   // 跳出循环后要做的操作
 
              }

               }


                 console.log('可以提交')

                  if(Informationnotfilled.value){
                // JSON.stringify
                // var dates=JSON.stringify({
                //   token:tokens.value,
                //   id:bjdata.value.id,
                //   userId:localStorage.getItem('userinfoId'),
                //   projectName:bjdata.value.projectName,
                //   projectEndDate:bjdata.value.projectEndDate,
                //   ccUserIds:selectallcsid.value,
                //   workAssignList:bjdata.value.workAssignList
                // })
                var officeLists=''
                bjdata.ccUserList.forEach(element => {
                  if(officeLists==''){
                    officeLists=element.id
                  }else{
                    officeLists+=','+element.id
                  }
                })
                var workAssignLists=[]
                console.log(bjdata.workAssignList)
// [{"targetUserId":"","projectName":"","projectEndDate":"","projectDescribe":"","projectFiles":"","projectFilesNames":""},{"projectName":"","projectEndDate":"","projectDescribe":"","projectFiles":"","projectFilesNames":""}]
                bjdata.workAssignList.forEach((element,index)=> {
                  workAssignLists[index]={}
                  console.log(element.workAssignListshow)
                  workAssignLists[index].targetUserId=element.targetUserId
                  workAssignLists[index].projectName=element.projectName
                  workAssignLists[index].projectEndDate=element.projectEndDate
                  workAssignLists[index].projectDescribe=element.projectDescribe
                  console.log(index)
                  console.log(element)
                })
                console.log(workAssignLists)

            
                
                var dates={
                  token:tokens.value,
                  userId:localStorage.getItem('userinfoId'),
                  projectName:bjdata.projectName,
                  projectEndDate:bjdata.projectEndDate,
                  ccUserIds:officeLists,
                  projectDescribe:bjdata.projectDescribe,
                  projectFiles:projectFiles,
                  projectFilesNames:projectFilesNames,
                  workAssignList:JSON.stringify(workAssignLists)
                }
                
                
                createProject({
                  token:tokens.value,
                  userId:localStorage.getItem('userinfoId'),
                  projectName:bjdata.projectName,
                  projectEndDate:bjdata.projectEndDate,
                  ccUserIds:officeLists,
                  projectDescribe:bjdata.projectDescribe,
                  projectFiles:projectFiles,
                  projectFilesNames:projectFilesNames,
                  workAssignList:JSON.stringify(workAssignLists)
                }).then(res=>{
                  console.log(res)
                  if(res.result==0){
                    detailsxjxmshow.value=true
                    detailsmlshow.value=false

                  }
                })
                
               }else{
                console.log('不可以提交')
                //失败更新toke
                //  var sjs=randomWord()
                // var datatime = Date.parse(new Date());
                // tokens.value=''+sjs+''+datatime+''+localStorage.getItem('userinfoId')
               }







    

              
              
              
              

                 //electallcsid抄送id
              console.log('shuji',bjdata.value)


            }
          }else{
             ElMessage({
                    message: '上传失败，请重新上传',
                    type: 'warning',
                })
          }
       
          
        }).catch(res=>{
           ElMessage({
                    message: res,
                    type: 'warning',
                })
        })

         
      });
      }else{
        // 无文件上传
        console.log('shuji2',bjdata)

         if(typeof(bjdata.projectName)=='undefined' || bjdata.projectName==''){
                 ElMessage({
                    message: '请输入您的项目名称',
                    type: 'warning',
                })
                Informationnotfilled.value=false
              }else if(typeof(bjdata.projectEndDate)=='undefined' || bjdata.projectEndDate==''){
                ElMessage({
                    message: '请选择您的项目截止日期',
                    type: 'warning',
                })
                Informationnotfilled.value=false
              }else if(typeof(bjdata.projectDescribe)=='undefined' || bjdata.projectDescribe==''){
                ElMessage({
                    message: '请添加您的项目描述',
                    type: 'warning',
                })
                Informationnotfilled.value=false
              }else if( typeof(bjdata.workAssignList) =='undefined' || bjdata.workAssignList==false){
                ElMessage({
                    message: '请添加您的指派列表',
                    type: 'warning',
                })
                Informationnotfilled.value=false
              }else {
            try{
                  
               
                bjdata.workAssignList.forEach(element => {
                if(element.targetUserId=='' ){
                  ElMessage({
                    message: '您的指派列表--有指派对人未添加',
                    type: 'warning',
                    
                })
                Informationnotfilled.value=false
                throw Error()
                }else if(element.projectName=='' ){
                  ElMessage({
                    message: '您的指派列表--有指派项目名称未填写',
                    type: 'warning',
                })
                Informationnotfilled.value=false
                throw Error()
                }else if(element.projectEndDate=='' ){
                  ElMessage({
                    message: '您的指派列表--有指派截止日期未选择',
                    type: 'warning',
                })
                Informationnotfilled.value=false
                throw Error()
                }else if(element.projectEndDate=='' ){
                  ElMessage({
                    message: '您的指派列表--有指派项目说明未填写',
                    type: 'warning',
                })
                Informationnotfilled.value=false
                throw Error()
                }
               
                
                 });
                 } catch(error) {
                   // 跳出循环后要做的操作
 
              }

               }
               
               if(Informationnotfilled.value){
                // JSON.stringify
                // var dates=JSON.stringify({
                //   token:tokens.value,
                //   id:bjdata.value.id,
                //   userId:localStorage.getItem('userinfoId'),
                //   projectName:bjdata.value.projectName,
                //   projectEndDate:bjdata.value.projectEndDate,
                //   ccUserIds:selectallcsid.value,
                //   workAssignList:bjdata.value.workAssignList
                // })
                var officeLists=''
                bjdata.ccUserList.forEach(element => {
                  if(officeLists==''){
                    officeLists=element.id
                  }else{
                    officeLists+=','+element.id
                  }
                })
                var workAssignLists=[]
                console.log(bjdata.workAssignList)
// [{"targetUserId":"","projectName":"","projectEndDate":"","projectDescribe":"","projectFiles":"","projectFilesNames":""},{"projectName":"","projectEndDate":"","projectDescribe":"","projectFiles":"","projectFilesNames":""}]
                bjdata.workAssignList.forEach((element,index)=> {
                  workAssignLists[index]={}
                  console.log(element.workAssignListshow)
                  workAssignLists[index].targetUserId=element.targetUserId
                  workAssignLists[index].projectName=element.projectName
                  workAssignLists[index].projectEndDate=element.projectEndDate
                  workAssignLists[index].projectDescribe=element.projectDescribe
                  console.log(index)
                  console.log(element)
                })
                console.log(workAssignLists)

            
                
                var dates={
                  token:tokens.value,
                  userId:localStorage.getItem('userinfoId'),
                  projectName:bjdata.projectName,
                  projectEndDate:bjdata.projectEndDate,
                  ccUserIds:officeLists,
                  projectDescribe:bjdata.projectDescribe,
                  projectFiles:'',
                  projectFilesNames:'',
                  workAssignList:JSON.stringify(workAssignLists)
                }
                
                
                createProject({
                  token:tokens.value,
                  userId:localStorage.getItem('userinfoId'),
                  projectName:bjdata.projectName,
                  projectEndDate:bjdata.projectEndDate,
                  ccUserIds:officeLists,
                  projectDescribe:bjdata.projectDescribe,
                  projectFiles:'',
                  projectFilesNames:'',
                  workAssignList:JSON.stringify(workAssignLists)
                }).then(res=>{
                  console.log(res)
                   if(res.result==0){
                    detailsxjxmshow.value=true
                    detailsmlshow.value=false
                  }
                })
                
               }else{
                console.log('不可以提交')
                //失败更新toke
                //  var sjs=randomWord()
                // var datatime = Date.parse(new Date());
                // tokens.value=''+sjs+''+datatime+''+localStorage.getItem('userinfoId')
               }
                 


      }

    }
       //全选抄送
    const selectall = ref(true)
    const selectallcsid=ref('')
  const selectallfun=()=>{

    selectall.value = !selectall.value
    if(selectall.value){
        zgshow.value=true
      officeList.value.forEach((element,index) => {
       element.isshow=true
       element.userList.forEach((elementone,indexone) => {
        elementone.isxz=true
       })
       if(element.subList){
       element.subList.forEach((elementone,indexone) => {
        elementone.isshow=true
        elementone.userList.forEach((elementtwo,indextwo) => {
        elementtwo.isxz=true
       })
       })
      }
     });
     
    }else{
       zgshow.value=false
      officeList.value.forEach((element,index) => {
       element.isshow=false
       element.userList.forEach((elementone,indexone) => {
        elementone.isxz=false
       })
       if(element.subList){
       element.subList.forEach((elementone,indexone) => {
        elementone.isshow=false
        elementone.userList.forEach((elementtwo,indextwo) => {
        elementtwo.isxz=false
       })
       })
       }
         
     });
    }
    
    console.log(officeList)
  } 

  const csobjfun =()=>{
    console.log('officeList',officeList.value)
    bjdata.ccUserList=[]
    let ifzzai=false
    officeList.value.forEach(element => {
      element.userList.forEach((elementone,indexone) => {
        let ifzzai=false
        console.log(elementone)
        // let elementone
        if(elementone.isxz==true) {
          if(bjdata.workAssignList!=''){
            bjdata.workAssignList.forEach(element12 => {
              console.log(element12)
            if(element12.targetUserId==elementone.id){
              ifzzai=true
            }
           });
           if(ifzzai==true){

           }else{
            bjdata.ccUserList.push(elementone)
                if(selectallcsid.value==''){
                selectallcsid.value = elementone.id
              }else{
                selectallcsid.value += ','+elementone.id
              }

           }
             

          }
          
          else{
             bjdata.ccUserList.push(elementone)
                if(selectallcsid.value==''){
                selectallcsid.value = elementone.id
              }else{
                selectallcsid.value += ','+elementone.id
              }
          }
          
          
        }
       })
       if(element.subList){
          element.subList.forEach((elementones,indexone) => {
            elementones.userList.forEach((elementtwo,indextwo) => {
              let ifzzai2=false
              if(elementtwo.isxz==true) {

                     if(bjdata.workAssignList!=''){
                              bjdata.workAssignList.forEach(element12 => {
                              if(element12.targetUserId==elementtwo.id){
                                     ifzzai2=true

                              }
                            });
                            if(ifzzai2==true){}else{
                                bjdata.ccUserList.push(elementtwo)
                                if(selectallcsid.value==''){
                                selectallcsid.value = elementtwo.id
                              }else{
                                selectallcsid.value += ','+elementtwo.id
                              }
                            }
                           

                            }
                            else{
                               bjdata.ccUserList.push(elementtwo)
                                if(selectallcsid.value==''){
                                selectallcsid.value = elementtwo.id
                              }else{
                                selectallcsid.value += ','+elementtwo.id
                              }
                            }


               
                }
            })
         })

       }
    
      
      
    });
    ccUserListshow.value=false
    detailsmlshow.value=true


    console.log("electallcsid.",selectallcsid.value)
  }
  const csnames=ref('')
  const caossuosuo=()=>{
    
    console.log(csnames.value)
     getCcUserList({userId:localStorage.getItem('userinfoId'),name:csnames.value}).then(
        res=>{
          console.log(res)
            let list=[]
            res.officeList.forEach((element,index)=> {
              if(element.userList!=''||element.subList.userList!=''){
                 element.isshow=true
                 
              }else{
                element.isshow=false
              }
              
              
              list[index]=element
              element.userList.forEach((elementuser,indexuser)=>{
                elementuser.isxz=false
                //是否有选中的
                bjdata.ccUserList.forEach(elementcc => {
                  if(elementuser.id==elementcc.id){
                    elementuser.isxz=true
                    element.isshow=true
                  }
                });
                if(elementuser.isxz==false){
                  selectall.value=false
                }
                
                list[index].userList[indexuser]=elementuser
              })
              
              if(typeof(element.subList)!='undefined'){
                element.subList.forEach((elements,indextow)=> {
                  

                  if(elements.userList!=''){
                 elements.isshow=true
              }else{
                elements.isshow=false
              }
                  
                  list[index].subList[indextow]=elements
                  elements.userList.forEach((elementuser,indexuser)=>{
                    elementuser.isxz=false
                    // 二级是否有选中的
                bjdata.ccUserList.forEach(elementccs => {
                  if(elementuser.id==elementccs.id){
                    elementuser.isxz=true
                    elements.isshow=true
                  }

                });
                 if(elementuser.isxz==false){
                  selectall.value=false
                }
                    list[index].subList[indextow].userList[indexuser]=elementuser
                  })

                })

              }
            });
          console.log('list',list)
          officeList.value=res.officeList
          ccUserListshow.value=true
          detailsmlshow.value=false

        }).catch(res => {
                ElMessage({
                    message: res,
                    type: 'error',
                })
            });

  }
  const csobjfun2 =()=>{
    console.log('进2')
    let newlist=[]
    officeList.value.forEach(element => {
      element.userList.forEach((elementone,indexone) => {
        newlist.push(elementone)
          
       })
       if(element.subList){
          element.subList.forEach((elementones,indexone) => {
            elementones.userList.forEach((elementtwo,indextwo) => {
              newlist.push(elementtwo)
                
                          
            })
         })

       }
    
      
      
    });
    
   
    console.log('全部的',newlist)
     console.log('开始列表',bjdata.ccUserList)
     newlist.forEach((element12,index12) => {
      bjdata.ccUserList.forEach((element2,index2) => {
        if(element12.id==element2.id){
          console.log('全部的',element12.name)
          if(element12.isxz==false){
            bjdata.ccUserList.splice(index2,1)
            newlist.splice(index12,1)
          }
          if(element12.isxz==true){
            newlist.splice(index12,1)
          }
        }
        
      });
     });

      console.log('裁剪后的newlist',newlist)
     console.log('裁剪后的列表bjdata.value.ccUserList',bjdata.ccUserList)


     newlist.forEach((element13,index13)=>{
      let ifzzai=false
      if(element13.isxz==true){
        
         if(bjdata.workAssignList!=''){
            
            bjdata.workAssignList.forEach(element12 => {
              console.log(element12)
            if(element12.targetUserId==element13.id){
              ifzzai=true
            }
           });

           if(ifzzai==true){

           }else{
            
           bjdata.ccUserList.push(element13)

           }
            


          }

      }
      


     })
       console.log('最后后的newlist',newlist)
     console.log('最后的列表bjdata.value.ccUserList',bjdata.ccUserList)
    // return
    // 去掉否的
    // newlist.forEach((elementnew,indexnew) => {
    //   bjdata.value.ccUserList.forEach((elementlist,indexlist) => {
    //     if (elementnew.id==elementlist.id &&elementnew.isxz==false) {
    //       newlist.splice(indexnew,1)
    //       bjdata.value.ccUserList.splice(indexlist,1)
    //     }
    //     if(elementnew.id==elementlist.id){
    //       newlist.splice(indexnew,1)
    //     }
    //     if(elementnew.isxz==false){
    //       newlist.splice(indexnew,1)
    //     }
    //   });
      
    // });
    // newlist.forEach((elementnew2,indexnew) => {
    //    bjdata.value.ccUserList.push(elementnew2)
      
    // });
    // console.log('去掉false的',newlist)
    //  console.log('开去掉带有false--newlist的ccUserList',bjdata.value.ccUserList)

    
    
    ccUserListshow.value=false
    detailsmlshow.value=true
  }
  const projectcgkchoss=()=>{
    bjdata.projectName=''
      bjdata.projectEndDate=''
      bjdata.projectDescribe=''
      bjdata.ccUserList=[]
      bjdata.workAssignList=[]
    detailsxjxmshow.value=false
    detailmbshow.value=false
  }
    return {
      csnames,
      caossuosuo,
      csobjfun2,
      projectcgkchoss,
      detailsxjxmshow,
      disabledDatestart,
      detailmbshow,
      ativitecsobj,
      csobjfun,
      selectall,
      selectallfun,
      tjwc,
      filelist,
      userId,
      filesuccess,
      beforeUpload,
      removezpobj,
      newjp,
      twodj,
      csdx,
      chooscsdx,
      ccUserListshow,
      disabledDate,
      ziindex,
      focusfun,
      changelist,
      panelzichangelist,
      qrobj,
      zpobj,
      onedj,
      zgshow,
      zuigaoc,
      defaultProps,
      data,
      addcs,
      listcloos,
      ativiteobj,
      listshow,
      listzk,
      panelchange,
      value1,
      bdshuj,
      qxclick,
      emit,
      bjdata,
      userListshow,
      caoso,
      chooscaoso,
      officeList,
      // projectedit,
       openprojectedit,
      //  detailsshow,
       detailslcshow,
       detailsmlshow,
       detailsthshow,
       detailssqcgshow,
       chossdetails,
       projectjs,
       projectchoss,
       projectth,
       projectrwqx,
       projectrwqr,
       projectrwsqwc,
       projectcreateshow,
       openprojectedit,
    };
  }
});
</script>
<style scoped>
.project-mb{
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
   background: #020113c4;
    z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
}
.projectdetails{
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0px;
    left: 0px;
    background: #020113c4;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}
.projectdetails-content{
  width: 786px;
  height: auto;
  max-height: 900px;
  background: #FFFFFF;
  border-radius: 32px;
  overflow: hidden;
  position: relative;
  padding-bottom: 40px;
}
.projectdetails-title{
  width: 100%;
  height: 88px;
  display: flex;
  justify-content: space-between;
  align-items: center;
   background: #020113;
}
.projectdetails-title-imgortitle{
  display: flex;
  justify-content: flex-start;
  align-items: center;
 margin-left: 32px;
}
.projectdetails-title-imgortitle img{
  height: 48px;
  width: auto;
}
.projectdetails-title-imgortitle h3{
font-size: 24px;
font-weight: bold;
color: #FFFFFF;
line-height: 36px;
}
.projectdetails-title-img{
  width: 48px;
  height: 48px;
  margin-right: 32px;
}
.projectdetails-title-img img{
  width: 48px;
  height: auto;
}
.projectcreate-k{
  width: auto;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin: 0 auto;
  margin-left: 40px;
  margin-top: 16px;
}
.projectcreate-content-k{
  margin-top: 40px;
  overflow-y: auto;
  width: 806px;
  height: 600px;
}

.projectcreate-k input{
  width: 572px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid #B3B2B8;
  box-sizing: border-box;
  padding: 0 10px;
  margin-left: 16px;
  font-size: 18px;
  color: #1F1E2E;
}
.projectcreate-name{
  width: 126px;
height: 28px;
font-size: 18px;
font-weight: 400;
color: #020113;
line-height: 28px;
}
.projectcreate-cs{
  width: 572px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-left: 16px;
  
}
.yccs-nun{
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid #000000;
  font-size: 18px;
  line-height: 64px;
  text-align: center;
  box-sizing: border-box;
}
.projectcreate-cs img{
  width: 64px;
  height: 64px;
  border-radius: 50%;
}
.projectcreate-tjzp div{
  margin: 0 auto;
  width: 164px;
  height: 40px;
  background: #020113;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  color: #FFFFFF;
  line-height: 40px;
  margin-top: 24px;
  text-align: center;
}
.projectcreate-upload{
  width: 572px;
height: 325px;
border-radius: 8px;
border: 1px solid #B5B4BA;
position: relative;
overflow: hidden;
}
.projectcreate-bt{
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 24px;
  text-align: center;
}
.projectcreate-bt-qx{
  width: 184px;
  height: 56px;
  border-radius: 32px;
  font-size: 24px;
  font-weight: bold;
  color: #020113;
  line-height: 56px;
}
.projectcreate-bt-wc{
  width: 184px;
  height: 56px;
  background: #020113;
  border-radius: 32px;
  font-size: 24px;
  font-weight: bold;
  color: #FFFFFF;
  line-height: 56px;
  margin-right: 40px;
}
.upload-demo .el-upload-list{
  position: absolute;
  top: 0;
  width: 100%;
}
.projectcreate-tjzp-k{
  width: 706px;
  height: auto;
  box-sizing: border-box;
  margin-left: 40px;
  margin-top: 16px;
}
.projectcreate-tjzp-k-t{
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 706px;
  height: 73px;
  background: #020113;
  border-radius: 8px 8px 0px 0px;
}
.projectcreate-tjzp-k-t h1{
  width: auto;
  height: 28px;
  font-size: 18px;
  font-weight: 400;
  color: white;
  line-height: 28px;
  margin-left: 24px;

}
.projectcreate-tjzp-k-t .projectcreate-choosorshow{
  width: auto;
  height: 48px;
  margin-right: 16px;
  display: flex;
}
.projectcreate-tjzp-k-t .projectcreate-choosorshow img{
  width: 38px;
  height: 38px;
}
.projectcreate-tjzp-nr{
  width: 706px;
  box-sizing: border-box;
  border: 2px solid #808089;
  
}
.projectcreate-tjzp-nr-list{
  display: flex;
  justify-content: flex-start;
  align-items: center;
  width: 706px;
  height: 73px;
}
.projectcreate-tjzp-nr-list-name{
  width: 93px;
  height: 28px;
  font-size: 18px;
  font-weight: 400;
  color: #020113;
  line-height: 28px;
  margin-left: 16px;
}

.projectcreate-tjzp-nr-list input{
  width: 573px;
height: 48px;
border-radius: 8px;
border: 1px solid #C1C1C6;
font-size: 18px;
}
.projectcreate-tjzp-nr-list-tx{
  display: flex;
  justify-content: flex-start;
  align-items: center;
}
.projectcreate-tjzp-nr-list-tx img{
  width: 64px;
  height: 64px;
}
.projectcreate-tjzp-nr-list-choss{
  width: 60px;
  height: 60px;
  cursor: pointer;
  margin: 0 auto;
}
.projectcreate-tjzp-nr-list-choss img{
  width: 60px;
  height: 60px;
}

.project-picker-zi{
  width: 573px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid #C1C1C6;
  font-size: 18px;
  /* margin-left: 16px;  */
}
.project-picker{
  width: 573px;
  height: 48px;
  border-radius: 8px;
  /* border: 1px solid #C1C1C6; */
  font-size: 18px;
  margin-left: 16px;
}
.el-input__wrapper{
  width: 100%;
  height: 100%;
}
.project-zp-obj-title{
  width: 786px;
  height: 88px;
  background: #020113;
  /* border-radius: 30px 30px 0px 0px; */
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.project-zp-obj-title h1{
  height: 36px;
  font-size: 24px;
  /* font-family: SourceHanSansCN-Bold, SourceHanSansCN; */
  font-weight: bold;
  color: #FFFFFF;
  line-height: 36px;
  box-sizing: border-box;
  padding: 0 40px;
}
.project-zp-obj-title div{
  width: 48px;
  height: 48px;
 
}
.project-zp-obj-title div img{
  width: 48px;
  height: 48px;
 
}

/* 对象选择 */
.project-zp-obj{
  position: fixed;
  width: 100%;
  height: 100%;
  z-index: 19999;
  top: 0;
  left: 0;
  background: #0201139f;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}
.project-zp-obj-k{
  width: 786px;
height: 706px;
background: #FFFFFF;
border-radius: 32px;
overflow: hidden;
position: relative;
}
.project-zp-obj-input{
  width: 706px;
height: 56px;
/* border-radius: 28px; */
/* opacity: 0.5; */
position: relative;
margin: 0 auto;
margin-top: 26px;
display: flex;
justify-content: flex-start;
align-items: center;


}
.project-zp-obj-input input{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 1px solid #020113;
border-radius: 28px;
box-sizing: border-box;
padding-left: 55px;
outline:none;
font-size: 24px;

}

.project-zp-obj-input img{
  width: 48px;
  height: 48px;
/* background: #020113; */
z-index: 100;
margin-left: 10px;
}
.project-zp-obj-tops{
  display: flex;
  justify-content: flex-start;
  align-items: center;
  z-index: 1000;
  position: relative;
}
.project-zp-obj-tops h1{
  
  /* width: 124px; */
  /* height: 28px; */
  font-size: 18px;
  font-family: SourceHanSansCN-Regular, SourceHanSansCN;
  font-weight: 400;
  color: #020113;
  line-height: 28px;
  margin-left: 5px;
}
.project-zp-obj-tops div{
  
  /* width: 124px; */
  /* height: 28px; */
  
  width: 18px;
  height: 18px;
  border: 1px solid #020113;
  font-weight: 400;
  color: #020113;
  line-height: 18px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;background-color: white;
}

.project-zp-obj-objlist{
  width: 100%;
  height: 500px;
  overflow: hidden;
  overflow-y: auto;
  margin-left: 40px;
  margin-top: 20px;
  position: relative;

}
.project-zp-obj-objlist-ul::after{
  content: '';
  width: 2px;
  height: 98%;
  margin-left: 30px;
  top: 0;
  left: -20px;
  position: absolute;
  border-left: 2px dashed black;
  z-index: 50;
}
.project-zp-obj-objlist-ul{
  padding-top: 10px;
  width: 100%;
  height: auto;
  margin-left: 30px;
  position: absolute;
  z-index: 2;
}
.project-zp-obj-objlist-ul2 li{
  
}
.project-zp-obj-zi .project-zp-obj-bm-zi{
  position: relative;
  left: 25px;
  display: flex;
  justify-content: left;
  align-items: center;
  margin-top: 5px;
  margin-bottom: 5px;
  background-color: white;
  
font-size: 18px;
   
}
.project-zp-obj-zi-bm .project-zp-obj-tops{
  position: relative;
  left: 25px;
  display: flex;
  justify-content: left;
  align-items: center;
  margin-top: 5px;
  margin-bottom: 5px;
}
.project-zp-obj-zi .project-zp-obj-bm-zi img{
  width: 48px;
  height: 48px;
  border-radius: 50%;
}
.project-zp-obj-zi .project-zp-obj-bm-zi h1{
  width: 304px;
height: 28px;
font-size: 18px;
font-weight: 400;
color: #020113;
line-height: 28px;
}
.hengxuxian1::after{
  content: '';
  position: absolute;
  left: -15px;
  width: 15px;
  height: 1px;
border-bottom: 2px dashed black;
}
.hengxuxian2::after{
  content: '';
  position: absolute;
  left: -15px;
  width: 50px;
  height: 1px;
  border-bottom: 2px dashed black;
}
.project-zp-obj-zi input{
  width: 18px;
  height: 18px;
}
.zp-img{
  border-radius: 50%;
}
.project-zp-obj-bt{
  z-index: 99999;
  position: absolute;
  right: 40px;
  bottom: 47px;
  width: auto;
  height: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.project-zp-obj-bt-qr{
  width: 184px;
  height: 56px;
  background: #020113;
  border-radius: 32px;
  text-align: center;
  line-height: 56px;
  font-size: 24px;
  color: #FFFFFF;
}
.project-zp-obj-zi .project-zp-obj-zi-2{
  padding-left: 40px;
  position: relative;
}
.project-zp-obj-bt-qx{
  font-size: 24px;
 font-weight: 400;
 color: #000000;
 display: flex;
 justify-content: center;
 align-items: center;
 margin-right: 20px;
}
.project-zp-obj-bt-qx input{
  width: 32px;
  height: 32px;
}

/* 新建成功 */
.project-lq{
  width: 636px;
  height: auto;
  
}
.project-lq-k{
  width: 636px;
  height: 593px;
  background: #FFFFFF;
  border-radius: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.project-lq div{
  text-align: center;
}
.project-lq div img{
  width: 200px;
  height: auto;
}
.project-lq div p{
  font-size: 32px;
  font-weight: 500;
  color: #000000;
  line-height: 42px;
  margin-top: 19px;
}
.project-lq div p span{
  border-bottom: 1px solid #2C2C2C;
}
.project-lq-choss{
  width: 72px;
  height: 72px;
  margin: 0 auto;
  margin-top: 16px;
}
.project-lq .project-lq-choss img{
  width: 72px;
  height: auto;
}
.project-lq-rw{
  width: 636px;
  height: 593px;
  background: #FFFFFF;
  border-radius: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.project-lq-rw p{
  font-size: 32px;
  font-weight: 500;
  color: #000000;
  line-height: 42px;
  text-align: center;
}
.project-lq-rw textarea{
  width: 498px;
  height: 231px;
  border-radius: 8px;
  border: 1px solid #020113;
  resize:none;
  box-sizing: border-box;
  padding: 8px;
  margin-top: 50px;
}
.project-lq-rw-cz{
  width: 100%;
  margin-top: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  
}
.project-lq-rw-cz .project-lq-rw-qx{
  width: 241px;
  height: 56px;
  background: #FFFFFF;
  border-radius: 32px;
  border: 1px solid #020113;
  text-align: center;
  line-height: 56px;
  font-size: 24px;
  font-weight: 400;
  color: #000000;
  box-sizing: border-box;
}
.project-lq-rw-cz .project-lq-rw-qr{
  width: 241px;
  height: 56px;
  background: #020113;
  border-radius: 32px;
  border: 1px solid #020113;
  text-align: center;
  line-height: 56px;
  font-size: 24px;
  font-weight: bold;
  color: #FFFFFF;
  margin-left: 18px;
  box-sizing: border-box;
  
}

 
</style>